package cn.tonyandmoney.voicenotes.notes.filters;

import cn.tonyandmoney.baidu.asr.entity.NluResult;
import cn.tonyandmoney.voicenotes.notes.enums.OperationEnum;
import cn.tonyandmoney.voicenotes.notes.presenter.IOperation;

/**
 * 确定的操作
 */
public class OperationFilter extends BaseFilter {

    public OperationFilter(IOperation iOperation) {
        super(iOperation);
    }

    @Override
    protected String getDomain() {
        return "operation";
    }

    @Override
    public boolean doFilter(NluResult result) {
        return super.doFilter(result);
    }

    @Override
    protected void operation(NluResult result) {
        if ("confirm".equals(result.getIntent())) {
            iOperation.operation(OperationEnum.CONFIRM);
        } else if ("cancel".equals(result.getIntent())) {
            iOperation.operation(OperationEnum.CANCEL);
        } else if ("save".equals(result.getIntent())) {
            iOperation.operation(OperationEnum.SAVE);
        }
    }
}
